/**
* GtkOrientation:
- * @GTK_ORIENTATION_HORIZONTAL: The widget is in horizontal orientation.
- * @GTK_ORIENTATION_VERTICAL: The widget is in vertical orientation.
+ * @GTK_ORIENTATION_HORIZONTAL: The element is in horizontal orientation.
+ * @GTK_ORIENTATION_VERTICAL: The element is in vertical orientation.
*
- * Represents the orientation of widgets which can be switched between horizontal
- * and vertical orientation on the fly, like #GtkToolbar.
+ * Represents the orientation of widgets and other objects which can be switched
+ * between horizontal and vertical orientation on the fly, like #GtkToolbar or
+ * #GtkGesturePan.
*/
typedef enum
{
GTK_PAN_DIRECTION_DOWN
} GtkPanDirection;
-/**
- * GtkPanOrientation:
- * @GTK_PAN_ORIENTATION_VERTICAL: vertical panning allowed
- * @GTK_PAN_ORIENTATION_HORIZONTAL: horizontal panning allowed
- *
- * Describes the panning axis of a #GtkGesturePan
- *
- * Since: 3.14
- */
-typedef enum
-{
- GTK_PAN_ORIENTATION_VERTICAL,
- GTK_PAN_ORIENTATION_HORIZONTAL
-} GtkPanOrientation;
-
#endif /* __GTK_ENUMS_H__ */
}
static void
-direction_from_offset (gdouble offset_x,
- gdouble offset_y,
- GtkPanOrientation orientation,
- GtkPanDirection *direction)
+direction_from_offset (gdouble offset_x,
+ gdouble offset_y,
+ GtkOrientation orientation,
+ GtkPanDirection *direction)
{
- if (orientation == GTK_PAN_ORIENTATION_HORIZONTAL)
+ if (orientation == GTK_ORIENTATION_HORIZONTAL)
{
if (offset_x > 0)
*direction = GTK_PAN_DIRECTION_RIGHT;
else
*direction = GTK_PAN_DIRECTION_LEFT;
}
- else if (orientation == GTK_PAN_ORIENTATION_VERTICAL)
+ else if (orientation == GTK_ORIENTATION_VERTICAL)
{
if (offset_y > 0)
*direction = GTK_PAN_DIRECTION_DOWN;
#define FACTOR 2
if (abs_x > abs_y * FACTOR)
direction_from_offset (offset_x, offset_y,
- GTK_PAN_ORIENTATION_HORIZONTAL, direction);
+ GTK_ORIENTATION_HORIZONTAL, direction);
else if (abs_y > abs_x * FACTOR)
direction_from_offset (offset_x, offset_y,
- GTK_PAN_ORIENTATION_VERTICAL, direction);
+ GTK_ORIENTATION_VERTICAL, direction);
else
return FALSE;
return (((direction == GTK_PAN_DIRECTION_LEFT ||
direction == GTK_PAN_DIRECTION_RIGHT) &&
- priv->orientation == GTK_PAN_ORIENTATION_HORIZONTAL) ||
+ priv->orientation == GTK_ORIENTATION_HORIZONTAL) ||
((direction == GTK_PAN_DIRECTION_UP ||
direction == GTK_PAN_DIRECTION_DOWN) &&
- priv->orientation == GTK_PAN_ORIENTATION_VERTICAL));
+ priv->orientation == GTK_ORIENTATION_VERTICAL));
}
static void
else
direction_from_offset (offset_x, offset_y, priv->orientation, &direction);
- offset = (priv->orientation == GTK_PAN_ORIENTATION_VERTICAL) ?
+ offset = (priv->orientation == GTK_ORIENTATION_VERTICAL) ?
ABS (offset_y) : ABS (offset_x);
g_signal_emit (gesture, signals[PAN], 0, direction, offset);
}
g_param_spec_enum ("orientation",
P_("Orientation"),
P_("Allowed orientations"),
- GTK_TYPE_PAN_ORIENTATION,
- GTK_PAN_ORIENTATION_HORIZONTAL,
+ GTK_TYPE_ORIENTATION,
+ GTK_ORIENTATION_HORIZONTAL,
GTK_PARAM_READWRITE));
/**
* GtkGesturePan::pan:
GtkGesturePanPrivate *priv;
priv = gtk_gesture_pan_get_instance_private (gesture);
- priv->orientation = GTK_PAN_ORIENTATION_HORIZONTAL;
+ priv->orientation = GTK_ORIENTATION_HORIZONTAL;
}
/**
* Since: 3.14
**/
GtkGesture *
-gtk_gesture_pan_new (GtkWidget *widget,
- GtkPanOrientation orientation)
+gtk_gesture_pan_new (GtkWidget *widget,
+ GtkOrientation orientation)
{
g_return_val_if_fail (GTK_IS_WIDGET (widget), NULL);
*
* Since: 3.14
*/
-GtkPanOrientation
+GtkOrientation
gtk_gesture_pan_get_orientation (GtkGesturePan *gesture)
{
GtkGesturePanPrivate *priv;
* Since: 3.14
*/
void
-gtk_gesture_pan_set_orientation (GtkGesturePan *gesture,
- GtkPanOrientation orientation)
+gtk_gesture_pan_set_orientation (GtkGesturePan *gesture,
+ GtkOrientation orientation)
{
GtkGesturePanPrivate *priv;
g_return_if_fail (GTK_IS_GESTURE_PAN (gesture));
- g_return_if_fail (orientation == GTK_PAN_ORIENTATION_HORIZONTAL ||
- orientation == GTK_PAN_ORIENTATION_VERTICAL);
+ g_return_if_fail (orientation == GTK_ORIENTATION_HORIZONTAL ||
+ orientation == GTK_ORIENTATION_VERTICAL);
priv = gtk_gesture_pan_get_instance_private (gesture);